package com.dubbo;

import java.sql.DriverManager;

/**
 * 会将所的静态成员变量和静态代码块合并为一个Cinit 方法 但是我的字节码指令并不是这样体现的
 */
public class CInit {
    static {
        a = 10;
    }

    private static int a = 20;

    static {
        a = 30;
    }
    public static void main(String[] args) {
        System.out.print(a);

    }
}

/**
 * Classfile /home/cqh/IdeaProjects/study/jvm/src/main/java/com/dubbo/com/dubbo/CInit.class
 *   Last modified 2022-9-18; size 493 bytes
 *   MD5 checksum 9d54e039d6bbba067ac1ba3f3955774e
 *   Compiled from "CInit.java"
 * public class com.dubbo.CInit
 *   minor version: 0
 *   major version: 52
 *   flags: ACC_PUBLIC, ACC_SUPER
 * Constant pool:
 *    #1 = Methodref          #6.#18         // java/lang/Object."<init>":()V
 *    #2 = Fieldref           #19.#20        // java/lang/System.out:Ljava/io/PrintStream;
 *    #3 = Fieldref           #5.#21         // com/dubbo/CInit.a:I
 *    #4 = Methodref          #22.#23        // java/io/PrintStream.print:(I)V
 *    #5 = Class              #24            // com/dubbo/CInit
 *    #6 = Class              #25            // java/lang/Object
 *    #7 = Utf8               a
 *    #8 = Utf8               I
 *    #9 = Utf8               <init>
 *   #10 = Utf8               ()V
 *   #11 = Utf8               Code
 *   #12 = Utf8               LineNumberTable
 *   #13 = Utf8               main
 *   #14 = Utf8               ([Ljava/lang/String;)V
 *   #15 = Utf8               <clinit>
 *   #16 = Utf8               SourceFile
 *   #17 = Utf8               CInit.java
 *   #18 = NameAndType        #9:#10         // "<init>":()V
 *   #19 = Class              #26            // java/lang/System
 *   #20 = NameAndType        #27:#28        // out:Ljava/io/PrintStream;
 *   #21 = NameAndType        #7:#8          // a:I
 *   #22 = Class              #29            // java/io/PrintStream
 *   #23 = NameAndType        #30:#31        // print:(I)V
 *   #24 = Utf8               com/dubbo/CInit
 *   #25 = Utf8               java/lang/Object
 *   #26 = Utf8               java/lang/System
 *   #27 = Utf8               out
 *   #28 = Utf8               Ljava/io/PrintStream;
 *   #29 = Utf8               java/io/PrintStream
 *   #30 = Utf8               print
 *   #31 = Utf8               (I)V
 * {
 *   public com.dubbo.CInit();
 *     descriptor: ()V
 *     flags: ACC_PUBLIC
 *     Code:
 *       stack=1, locals=1, args_size=1
 *          0: aload_0
 *          1: invokespecial #1                  // Method java/lang/Object."<init>":()V
 *          4: return
 *       LineNumberTable:
 *         line 3: 0
 *
 *   public static void main(java.lang.String[]);
 *     descriptor: ([Ljava/lang/String;)V
 *     flags: ACC_PUBLIC, ACC_STATIC
 *     Code:
 *       stack=2, locals=1, args_size=1
 *          0: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
 *          3: getstatic     #3                  // Field a:I
 *          6: invokevirtual #4                  // Method java/io/PrintStream.print:(I)V
 *          9: return
 *       LineNumberTable:
 *         line 14: 0
 *         line 15: 9
 *
 *   static {};
 *     descriptor: ()V
 *     flags: ACC_STATIC
 *     Code:
 *       stack=1, locals=0, args_size=0
 *          0: bipush        10
 *          2: putstatic     #3                  // Field a:I
 *          5: bipush        20
 *          7: putstatic     #3                  // Field a:I
 *         10: bipush        30
 *         12: putstatic     #3                  // Field a:I
 *         15: return
 *       LineNumberTable:
 *         line 5: 0
 *         line 8: 5
 *         line 11: 10
 *         line 12: 15
 * }
 * SourceFile: "CInit.java"
 */